<template>
  <div class="">
    <p-modal
      title="新增考核信息"
      :visible="visible"
      :confirm-loading="confirmLoading"
      @ok="handleOk"
      @cancel="handleCancel"
    >
      <p-form-model
        ref="ruleForm"
        :model="form"
        :rules="rules"
        :label-col="labelCol"
        :wrapper-col="wrapperCol"
      >
        <p-form-model-item ref="assessProject" label="考核项目" prop="assessProject">
          <p-input
            v-model="form.assessProject"
          />
        </p-form-model-item>
        <p-form-model-item ref="score" label="分数" prop="score">
          <p-input
            v-model="form.score"
          />
        </p-form-model-item>
        <p-form-model-item ref="assessStandard" label="考核标准" prop="assessStandard">
          <p-input
            v-model="form.assessStandard"
          />
        </p-form-model-item>
        <p-form-model-item ref="assessScoreDetail" label="考核评分明细项" prop="assessScoreDetail">
          <p-input
            v-model="form.assessScoreDetail"
          />
        </p-form-model-item>

      </p-form-model>
    </p-modal>
  </div>
</template>

<script type="text/javascript">
import { postAction, getAction, deleteAction, api, putAction } from "@/api/manage";


export default {
  data() {
    return {
      labelCol: {
        span: 6
      },
      wrapperCol: {
        span: 12
      },
      visible: false,
      confirmLoading: false,
      form: {
        assessProject: '',
        score: '',
        assessStandard: '',
        assessScoreDetail: '',
      },      
      rules: {
        assessProject: [
          { required: true, message: '请输入考核项目', trigger: 'blur' },
        ],
        score: [
          { required: true, message: '请输入分数', trigger: 'blur' },
        ],

        assessStandard: [
          { required: true, message: '请输入考核标准', trigger: 'blur' },
        ],
        assessScoreDetail: [
          { required: true, message: '请输入考核评分明细项', trigger: 'blur' },
        ],

      },
 

    };
  },
  mounted() {
  },
  methods: {

    showModal(record) {
      this.visible = true;
    },
    handleOk(e) {
      this.$refs.ruleForm.validate(valid => {
        if (valid) {
          this.$emit('addAssessDetail', this.form)
          this.handleCancel()
        } else {
          return false;
        }
      });
    },
    handleCancel(e) {
      this.visible = false;
      Object.assign(this.form, this.$options.data().form);
      this.$refs.ruleForm.resetFields()
    },

  },
  components: {},
};
</script>

<style lang="less" scoped>
</style>
